/* -----------------------------------------------------------------------------
 * PROJECT    : net.lwf
 * FILE       : SumInput.java
 *
 * HISTORY:
 * Date          Author                        Description
 * ----------------------------------------------------------------------------- 
 * Feb 2, 2009  Raghu Sarraff	 		        Created
 */
package lwf.handler.entities.math;

import java.util.Map;

import net.lwf.handler.util.MathUtil;


public class SumInput {
	
	private int datarowsinsum = 2; //Default
	private int digits = 1; //By default
	private int decimalpoints = 0;
	private int requiredsums = 1; //Default 
	private String operation;
	private int sumsperrow = 4;
	private int requiredpages = 1;//Default
	private int rowsperpage = 1;
	private Map<String, String> validOperations;

	/**
	 * @return Returns the requiredpages.
	 */
	public int getRequiredpages() {
		return requiredpages;
	}
	/**
	 * @param requiredpages The requiredpages to set.
	 */
	public void setRequiredpages(int requiredpages) {
		this.requiredpages = requiredpages;
	}
	/**
	 * @return Returns the rowsperpage.
	 */
	public int getRowsperpage() {
		return rowsperpage;
	}
	/**
	 * @param rowsperpage The rowsperpage to set.
	 */
	public void setRowsperpage(int rowsperpage) {
		this.rowsperpage = rowsperpage;
	}
	public SumInput(String operation) {
		this.operation = operation;
	}
	
	/**
	 * @return Returns the sumsperrow.
	 */
	public int getSumsperrow() {
		return sumsperrow;
	}
	/**
	 * @param sumsperrow The sumsperrow to set.
	 */
	public void setSumsperrow(int sumsperrow) {
		this.sumsperrow = sumsperrow;
	}
	/**
	 * @return Returns the requiredsums.
	 */
	public int getRequiredsums() {
		return requiredsums;
	}
	/**
	 * @param requiredsums The requiredsums to set.
	 */
	public void setRequiredsums(int requiredsums) {
		this.requiredsums = requiredsums;
	}
	/**
	 * @return Returns the datarowsinsum.
	 */
	public int getDatarowsinsum() {
		return this.datarowsinsum;
	}
	/**
	 * @param datarowsinsum The datarowsinsum to set.
	 */
	public void setDatarowsinsum(int datarowsinsum) {
		this.datarowsinsum = datarowsinsum;
	}
	/**
	 * @return Returns the decimalpoints.
	 */
	public int getDecimalpoints() {
		return decimalpoints;
	}
	/**
	 * @param decimalpoints The decimalpoints to set.
	 */
	public void setDecimalpoints(int decimalpoints) {
		this.decimalpoints = decimalpoints;
	}
	/**
	 * @return Returns the digits.
	 */
	public int getDigits() {
		return digits;
	}
	/**
	 * @param digits The digits to set.
	 */
	public void setDigits(int digits) {
		this.digits = digits;
	}
	
	public Map<String, String> getValidOperations() {
		return validOperations;
	}
	public void setValidOperations(Map<String, String> validOperations) {
		this.validOperations = validOperations;
	}
	/**
	 * @return Returns the operation.
	 */
	public String getOperation() {
		if(this.operation == null) {
			String random_operation = MathUtil.getOperation();
			while(!this.validOperations.containsKey(random_operation)) {
				random_operation = MathUtil.getOperation();
			}
			//For Random operation
			//return MathUtil.getOperation();
			return random_operation;
		}
		return operation;
	}
	
} //SumInput

